<template>
	<view>
		<!-- <button type="default" @click="openMap('104.232277', '30.6483')">查看位置</button> -->
		<view v-for="(item, index) in mapList" :key="index"><button type="default" @click="openMap(item)">查看位置-{{item.where}}</button></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			mapList: [
				{ latitude: 30.647199, longitude: 104.220226 ,where:"西河[地铁站]"}, 
				{ latitude: 30.646816, longitude: 104.180956 ,where:"成都大学[地铁站]"},
			]
		};
	},
	methods: {
		openMap(item) {
			uni.openLocation({
				latitude: item.latitude,
				longitude: item.longitude,
				success: function() {
					console.log('success');
				}
			});
			// uni.getLocation({
			// 	type: 'gcj02', //返回可以用于uni.openLocation的经纬度
			// 	success: function(res) {
			// 		console.log(res);
			// 		const latitude = res.latitude;
			// 		const longitude = res.longitude;
			// 		uni.openLocation({
			// 			latitude: latitude,
			// 			longitude: longitude,
			// 			success: function() {
			// 				console.log('success');
			// 			}
			// 		});
			// 	}
			// });
		}
	}
};
</script>

<style scoped></style>
